<?php
/**
 * Created by PhpStorm.
 * User: elliot
 * Date: 2017/4/12
 * Time: 16:31
 */
namespace app\wechat\controller;
use think\Controller;

class Message extends Controller{

    public function sendMessage($name = '钱时代', $operation = 1, $money, $openId){
        $message = new \app\service\MessagePush();
        if($operation == 1){
            $operation = '存入';
        } else {
            $operation = '取出';
        }
        $send = array(
            'first'    => ['value' => '亲爱的用户，您已成功完成充值'],
            'keyword1' => ['value' => $name, 'color' => '#743434'],
            'keyword2' => ['value' => '中国工商银行', 'color' => '#743434'],
            'keyword3' => ['value' => $operation, 'color' => '#743434'],
            'keyword4' => ['value' => $money, 'color' => '#743434'],
            'keyword5' => ['value' => '-0.00', 'color' => '#743434'],
            'remark' => '已验证用户会第一时间收到交易提醒哦'
        );
        if($message->doSend($openId, 'K3U35y5FVxEL659E8veZnvzj09D79TbeXnt69f-n5Ms', '', $send, '#7B68EE')){
            return true;
        } else {
            return false;
        }
    }
}